package com.dayu.gulimall.cart.service;

import com.dayu.gulimall.cart.vo.Cart;
import com.dayu.gulimall.cart.vo.CartItem;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * @author dayu
 * @version 1.0
 * @email dayu007@foxmail.com
 * @date 2021/3/26 7:42
 * @description
 */
public interface CartService {

    /**
     * 添加商品信息
     * @param skuId
     * @param num
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    CartItem addToCart(Long skuId, Integer num) throws ExecutionException, InterruptedException;

    /**
     * 添加成功后操作，获取商品信息
     * @param skuId
     * @return
     */
    CartItem getCartItemInfo(Long skuId);

    Cart getCart() throws ExecutionException, InterruptedException;

    /**
     * 修改选中状态
     * @param skuId
     * @param check
     */
    void checkItem(Long skuId, Integer check);

    void countItem(Long skuId, Integer num);

    void deleteItem(Long skuId);

    /**
     * 获取当前用户选中的购物项
     * @return
     */
    List<CartItem> getCurrentUserItems() throws ExecutionException, InterruptedException;
}
